// import Home from "@/views/Home";
// import Search from "@/views/Search/index.vue";
// import Login from "@/views/Login/index.vue";
// import Register from "@/views/Register/index.vue";
// import Detail from "@/views/Detail/index.vue"
//懒加载了就不用这样引入了


// meta:{isHiddenFooter:true}//meta路由元信息，来添加自定义的属性存储一些信息等等
const routes = [
  { path: "/", redirect: "/home" }, //重定向
  { path: "/home", component: ()=>import('@/views/Home'), //懒加载
    meta: {
      isHiddenNav:true // 相当于是一种状态，根据这个状态来区分是home还是search
  }},
  {
    // path: "/search", query参数的形式
    path: '/search/:keyword?', // ?类似于正则中的? 表示有1个或是1个没有
    component: ()=>import('@/views/Search/index.vue'),
    name:'search'
  },
  {
    path: '/login',
    name:'login',
    component: ()=>import('@/views/Login/index.vue'),
    meta: {
      isHiddenFooter: true
    }
  },
  {
    path: '/register',
    name:'register',
    component: ()=>import('@/views/Register/index.vue'),
    meta: {
      isHiddenFooter: true
    }
  },
  {
    name:'detail',
    path:'/detail/:id',//有参数
    component:()=>import('@/views/Detail/index.vue'),
    props:true // 添加了这一行代码，会将传入的params参数直接用props来接收
  },
  {
    name:'addCartSuccess',
    path:'/addCartSuccess',
    component: ()=>import('@/views/AddCartSuccess/index.vue')
  },
  {
    name:'shopcart',
    path:'/shopcart',
    component:()=>import('@/views/ShopCart/index.vue')
  },
];
export default routes